<template>
  <div class="safetyOrdered">
    <div>
      <el-form ref="dataForm" class="oldIndent_nav">
        <div style="margin-bottom:20px;margin-top:10px;">
          <span style="margin-left:60px">姓名：</span>
          <el-input placeholder="请输入姓名" style="width:200px" />
          <span style="margin-left:60px">电话号码：</span>
          <el-input placeholder="请输入电话" style="width:200px" />
          <span style="margin-left:30px">起始时间:</span>
          <el-date-picker
            type="date"
            placeholder="选择起始时间"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyyMMdd"
          />
          <span style="margin-left:50px">结束时间:</span>
          <el-date-picker
            type="date"
            placeholder="选择结束时间"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyyMMdd"
          />
          <el-button type="primary" round style="float:right;margin-right:200px">查询</el-button>
        </div>
      </el-form>
    </div>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="id" align="center" label="订单号" />
      <el-table-column prop="user" align="center" label="求助人" />
      <el-table-column prop="user2" align="center" label="接单人" />
      <el-table-column prop="phone" align="center" label="联系方式" />
      <el-table-column prop="state" align="center" label="服务类型" />
      <el-table-column prop="time" align="center" label="求助时间" />
      <el-table-column prop="money" align="center" label="赏金" />
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="small" type="success" @click="handleClick(scope.row)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-col :span="24" class="toolbar" style="text-align: center;">
      <el-pagination
        background
        :current-page="currentPage"
        :page-count="pageNum"
        :page-size="pagesize"
        style="margin-top:30px;margin-bottom:30px"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-col>
  </div>
</template>
<script>
export default {
  data() {
    return {
      currentPage: 1, // 初始页
      pagesize: 10, // 当前页面内的列表行数
      pageCount: 1,
      pageNum: 1, // 页数
      total: 3,
      tableData: [
        {
          id: '5648621343',
          user: '刘女士',
          user2: '物业组刘武',
          phone: '13199451349',
          state: '人身保护',
          time: '2019-12-01 19:34:56',
          money: '40元'
        },
        {
          id: '5648621343',
          user: '吴女士',
          user2: '物业组刘武',
          phone: '13195421121',
          state: '安全护送',
          time: '019-12-06 14:00',
          money: '50元'
        },
        {
          id: '5648621343',
          user: '王浩',
          user2: '物业组刘武',
          phone: '1568742111',
          state: '人身保护',
          time: '2019-12-06 16:40',
          money: '20元'
        }
      ]
    }
  },
  mounted() {},
  methods: {
    handleClick(row) {
      this.$router.push({ name: '已完成接单详情', params: { data: row }})
    },
    // 当前页
    handleSizeChange: function(pagesize) {
      this.pagesize = pagesize
    },
    // 换页：更新列表数据
    handleCurrentChange: function(currentPage) {
      this.currentPage = currentPage
    }
  }
}
</script>
<style lang="scss" scoped>
.safetyOrdered {
  margin-top: 55px;
}
</style>
